// ================================================================
// Module: Virtual Machine
// ================================================================
const thexasm_vm = (()=>{
    // Alias
    const REG = thex.REG

    // Run an program with new Instance
    // Input:
    //      program:[]      Bytecode of Compile result
    // Output: {}
    //      .regs:[]        Register values with Program End
    //      .stack:[]       Stack values with Program End
    //      .stdout:[]      Lines of Standard Output
    function Run(program){
        let stdout = []
        let stack = []
        let regs = []
        for (const i in REG){
            regs[REG[i]] = 0
        }
        return {regs, stack, stdout}
    }
    return {Run}
})();

